package com.xiaohudie.SSGworket;

import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @Author xiao hu die
 * @Date 2022/3/27 13:37
 * @Version 1.0
 */
public class IpAdress {
    public static void main(String[] args) {
        try {
            Inet4Address inet4Address = (Inet4Address) Inet4Address.getByName("127.0.0.1");
            System.out.println(inet4Address);
            System.out.println(inet4Address.getHostName());
            System.out.println(inet4Address.getHostAddress());
           /* Inet4Address inet4Address2 = (Inet4Address) Inet4Address.getByName("www.baidu.com");
            System.out.println(inet4Address2);
            InetAddress localHost = Inet4Address.getLocalHost();
            System.out.println(localHost);*/
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }
}
